<?php
/**
 * Created by PhpStorm.
 * User: M
 * Date: 2020/8/25
 * Time: 10:35
 */

namespace app\common;


class Common
{

    // 获取用户设备
    public function clientOS() {
        $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        if(strpos($agent, 'windows nt')) {
            $platform = 'windows';
        } elseif(strpos($agent, 'macintosh')) {
            $platform = 'mac';
        } elseif(strpos($agent, 'ipod')) {
            $platform = 'ipod';
        } elseif(strpos($agent, 'iphone')) {
            $platform = 'iphone';
        } elseif (strpos($agent, 'android')) {
            $platform = 'android';
        } elseif(strpos($agent, 'unix')) {
            $platform = 'unix';
        } elseif(strpos($agent, 'linux')) {
            $platform = 'linux';
        } elseif(strpos($agent, 'ipad')) {
            $platform = 'ipad';
        } else {
            $platform = 'other';
        }
        return $platform;
    }




}